﻿using System;
using System.Collections;
using System.Diagnostics;
using System.Configuration;
using System.Xml;
using System.Collections.Specialized;
using System.Data.SqlClient;
using System.Data;
using System.Web;

namespace HKEA.CMS.Core.Utility
{
    public class ConfigurationManager
    {
        public static string GetConfigStrByName(string str)
        {
            return System.Configuration.ConfigurationManager.AppSettings[str].ToString();
        }

        public static string GetMemberLoginFrom()
        {
            string strHost = string.Empty;
            string strVersionValue= GetConfigStrByName("Version");
            switch (strVersionValue)
            {
                case "0" :
                    strHost = GetConfigStrByName("WebServiceHostTest");
                    break;
                default:
                    strHost = GetConfigStrByName("WebServiceHot");
                    break;
            }
            return strHost;
        }

        public static string GetConnString
        {
            get
            {
                return System.Configuration.ConfigurationManager.ConnectionStrings["strConnection"].ConnectionString;
            }
        }

        #region 邮件设置
        /// <summary>
        /// 邮件设置－邮件服务器
        /// </summary>
        public string Host
        {
            get { return System.Configuration.ConfigurationManager.AppSettings["EMailhost"].ToString(); }
        }


        public string ShowEmail
        {
            get { return System.Configuration.ConfigurationManager.AppSettings["ShowEmail"].ToString(); }
        }
        /// <summary>
        /// 邮件设置－发送帐号
        /// </summary>
        public string MailUserID
        {
            get { return System.Configuration.ConfigurationManager.AppSettings["EmailSender"].ToString(); }
        }

        /// <summary>
        /// 邮件设置－发送帐号密码
        /// </summary>
        public string MailPW
        {
            get { return System.Configuration.ConfigurationManager.AppSettings["EmailSerderPW"].ToString(); }
        }

        /// <summary>
        /// 邮件设置－发件人名称
        /// </summary>
        public string MailFrom
        {
            get { return System.Configuration.ConfigurationManager.AppSettings["MailFrom"].ToString(); }
        }

        /// <summary>
        /// 邮件设置－网站管理员邮件地址
        /// </summary>
        public string WebMasterEmail
        {
            get { return System.Configuration.ConfigurationManager.AppSettings["WebMasterEmail"].ToString(); }
        }


        #endregion
    }
}
